/*AyflEomXWyqCHfdTxzWda+ZiNDhxOZJeZF/oshAh0uo=*/
/*
 * @Author: xiahui
 * @PageInfo: 卡片按钮区
 * @Date: 2019-01-10 17:36:59
 * @Last Modified by: guoylei
 * @Last Modified time: 2021-07-13 19:24:53
 */
import { BUTTONID, UISTATUS, FIELDS, AREA } from '../../constance';
import backBtnClick from './backBtnClick';
import addLineBtnClick from './addLineBtnClick';
import pageInfoClick from './pageInfoClick';
import deleteLineBtnClick from './deleteLineBtnClick';
import cancelBtnClick from './cancelBtnClick';
import editBtnClick from './editBtnClick';
import deleteBtnClick from './deleteBtnClick';
import copyBtnClick from './copyBtnClick';
import saveBtnClick from './saveBtnClick';
import refreshBtnClick from './refreshBtnClick';
import manualBtnClick from './manualBtnClick';
import ref20BtnClick from './ref20BtnClick';
import commitBtnClick from './commitBtnClick';
import unCommitBtnClick from './unCommitBtnClick';
import validateBtnClick from './validateBtnClick';
import unValidateBtnClick from './unValidateBtnClick';
import freezeBtnClick from './freezeBtnClick';
import unFreezeBtnClick from './unFreezeBtnClick';
import endBtnClick from './endBtnClick';
import unEndBtnClick from './unEndBtnClick';
import modifyBtnClick from './modifyBtnClick';
import modifyDeleteBtnClick from './modifyDeleteBtnClick';
import approveInfoBtnClick from './approveInfoBtnClick';
import queryAboutBusinessBtnClick from './queryAboutBusinessBtnClick';
import fileBtnClick from './fileBtnClick';
import printBtnClick from './printBtnClick';
import outputBtnClick from './outputBtnClick';
import saveCommitBtnClick from './saveCommitBtnClick';
import quitBtnClick from './quitBtnClick';
import copyLineBtnClick from './copyLineBtnClick';
import insertLineBtnClick from './insertLineBtnClick';
import linkPriceInfoBtnClick from './linkPriceInfoBtnClick';
import reRangeRowNoBtnClick from './reRangeRowNoBtnClick';
import cancelBBtnClick from './cancelBBtnClick';
import pasteLineBtnClick from './pasteLineBtnClick';
import controlScopeBtnClick from './controlScopeBtnClick';
import structFileBtnClick from './structFileBtnClick';
import payExecStateBtnClick from './payExecStateBtnClick';
import payPlanBtnClick from './payPlanBtnClick';
import imageViewBtnClick from './imageViewBtnClick';
import imageScanBtnClick from './imageScanBtnClick';
import modifyHistoryBtnClick from './modifyHistoryBtnClick';
import ref28BtnClick from './ref28BtnClick';
import saveAndCommit from './saveAndCommit';
import printCountQuery from '../../../../../scmpub/scmpub/pub/tool/printCountQuery';
import tempStorageBtnClick from './tempStorageBtnClick';
import sendMailBtnClick from './sendMailBtnClick';

// 表头按钮区操作
function buttonClick(props, id, text, record, index) {
	switch (id) {
		case BUTTONID.Back:
			backBtnClick.call(this, props);
			break;
		case BUTTONID.Manual:
			manualBtnClick.call(this, props);
			break;
		case BUTTONID.Ref20:
			ref20BtnClick.call(this, props);
			break;
		case BUTTONID.Ref28:
			ref28BtnClick.call(this, props);
			break;
		case BUTTONID.Edit:
			editBtnClick.call(this, props);
			break;
		case BUTTONID.Delete:
			deleteBtnClick.call(this, props);
			break;
		case BUTTONID.Copy:
			copyBtnClick.call(this, props);
			break;
		case BUTTONID.Save:
			saveBtnClick.call(this, props);
			break;
		case BUTTONID.SaveCommit:
			saveAndCommit.call(this);
			// saveCommitBtnClick.call(this, props);
			break;
		case BUTTONID.Cancel:
			cancelBtnClick.call(this, props);
			break;
		case BUTTONID.Quit:
			quitBtnClick.call(this, props);
			break;

		case BUTTONID.Commit:
			commitBtnClick.call(this, props);
			break;
		case BUTTONID.SendMail:
			sendMailBtnClick.call(this, props);
			break;
		case BUTTONID.UnCommit:
			unCommitBtnClick.call(this, props);
			break;
		case BUTTONID.Validate:
			validateBtnClick.call(this, props);
			break;
		case BUTTONID.UnValidate:
			unValidateBtnClick.call(this, props);
			break;
		case BUTTONID.Freeze:
			freezeBtnClick.call(this, props);
			break;
		case BUTTONID.UnFreeze:
			unFreezeBtnClick.call(this, props);
			break;
		case BUTTONID.End:
			endBtnClick.call(this, props);
			break;
		case BUTTONID.UnEnd:
			unEndBtnClick.call(this, props);
			break;
		case BUTTONID.Modify:
			modifyBtnClick.call(this, props);
			break;
		case BUTTONID.ModifyDelete:
			modifyDeleteBtnClick.call(this, props);
			break;

		case BUTTONID.ApproveInfo:
			approveInfoBtnClick.call(this, props);
			break;
		case BUTTONID.QueryAboutBusiness:
			queryAboutBusinessBtnClick.call(this, props);
			break;

		case BUTTONID.ControlScope:
			controlScopeBtnClick.call(this, props);
			break;
		case BUTTONID.PayPlan:
			payPlanBtnClick.call(this, props);
			break;
		case BUTTONID.StructFile:
			structFileBtnClick.call(this, props);
			break;
		case BUTTONID.File:
			fileBtnClick.call(this, props);
			break;
		case BUTTONID.ModifyHistory:
			modifyHistoryBtnClick.call(this, props);
			break;
		case BUTTONID.PayExecState:
			payExecStateBtnClick.call(this, props);
			break;
		case BUTTONID.Print:
			printBtnClick.call(this, props);
			break;
		case BUTTONID.Output:
			outputBtnClick.call(this, props);
			break;

		case BUTTONID.Refresh:
			refreshBtnClick.call(this, props);
			break;

		case BUTTONID.ImageScan:
			imageScanBtnClick.call(this, props);
			break;
		case BUTTONID.ImageView:
			imageViewBtnClick.call(this, props);
			break;
		case BUTTONID.PrintCountQuery:
			let CONST = { hid: FIELDS.pk_ct_pu, area: AREA.cardFormId };
			printCountQuery.call(this, props, { type: 2, CONST, modal: 'code-config' });
			break;
		case BUTTONID.TemporaryStorage: //暂存
			tempStorageBtnClick.call(this, props);
			break;
		case BUTTONID.ShowDraft: //显示草稿
			this.setState({ showTemp: true });
			break;
	}
}

// 表体按钮操作
function lineBtnClick(moduleId, props, id, text, record, index) {
	switch (id) {
		case BUTTONID.Open:
			let status = props.getUrlParam('status');
			if (!status || status == UISTATUS.browse) {
				props.cardTable.toggleRowView(moduleId, record);
			} else {
				props.cardTable.openModel(moduleId, UISTATUS.edit, record, index);
			}
			break;
		case BUTTONID.AddLine:
		case BUTTONID.AddLineTerm:
		case BUTTONID.AddLinePay:
		case BUTTONID.AddLineFee:
		case BUTTONID.AddLineMemora:
			addLineBtnClick.call(this, props, moduleId);
			break;
		case BUTTONID.DeleteLine:
		case BUTTONID.DeleteLineTerm:
		case BUTTONID.DeleteLinePay:
		case BUTTONID.DeleteLineFee:
		case BUTTONID.DeleteLineMemora:
			deleteLineBtnClick.call(this, props, moduleId, record, index);
			break;
		case BUTTONID.CopyLine:
		case BUTTONID.CopyLineTerm:
		case BUTTONID.CopyLinePay:
		case BUTTONID.CopyLineFee:
		case BUTTONID.CopyLineMemora:
			copyLineBtnClick.call(this, props, moduleId);
			break;
		case BUTTONID.PasteLineToTail:
		case BUTTONID.PasteLineToTailTerm:
		case BUTTONID.PasteLineToTailPay:
		case BUTTONID.PasteLineToTailFee:
		case BUTTONID.PasteLineToTailMemora:
		case BUTTONID.PasteLine:
		case BUTTONID.PasteLineTerm:
		case BUTTONID.PasteLinePay:
		case BUTTONID.PasteLineFee:
		case BUTTONID.PasteLineMemora:
			pasteLineBtnClick.call(this, props, moduleId, record, index);
			break;
		case BUTTONID.CancelB:
		case BUTTONID.CancelBTerm:
		case BUTTONID.CancelBPay:
		case BUTTONID.CancelBFee:
		case BUTTONID.CancelBMemora:
			cancelBBtnClick.call(this, props, moduleId);
			break;
		case BUTTONID.InsertLine:
			insertLineBtnClick.call(this, props, moduleId, record, index);
			break;
		case BUTTONID.LinkPriceInfo:
			linkPriceInfoBtnClick.call(this, props, moduleId);
			break;
		case BUTTONID.ReRangeRowNo:
			reRangeRowNoBtnClick.call(this, props, moduleId);
			break;
	}
}

export { buttonClick, lineBtnClick, pageInfoClick, modifyBtnClick };

/*AyflEomXWyqCHfdTxzWda+ZiNDhxOZJeZF/oshAh0uo=*/